#ifndef DRAWCHART_H
#define DRAWCHART_H

#include <QtCore>
#include <QObject>
#include <QtGui/QPainter>

class DrawChart : public QObject
{
	Q_OBJECT
public:
	explicit DrawChart(QObject *parent = 0);

public slots:
    void drawLineChart(int xNum, QString title, QString line_name);
    void drawPieChart(QString title);

    void inputLineChart(qreal yNum);
    void inputLineXName(QString xName);
//    void inputPieChart(QString name/*,QColor color*/, float Percentage);
    void inputPieChart(QString name,QString color, float percentage);
    void inputClear();

    void saveChart();

private:
    QList<qreal> line_y ;
    QList<QString> line_xname ;
    QList<qreal> pie_percent ;
    QList<QString> pie_name ;
    QList<QString> pie_color ;

    qreal findMax();
    qreal findMin();

    QString ChartPath;

signals:
    void drawChartFinish(QString path);
    void drawChartError();

    void savedchart(bool saved);
};

#endif // DRAWCHART_H
